<?php /* Smarty version Smarty-3.1.6, created on 2018-07-29 18:32:33
         compiled from "/Applications/MAMP/htdocs/svn/myshop/Home/View/Draw/roomlist.html" */ ?>
<?php /*%%SmartyHeaderCode:12115815395b5d47ff155972-68152944%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '499b243c9a99fa0c891527d7763ca7bb6b4b42c8' => 
    array (
      0 => '/Applications/MAMP/htdocs/svn/myshop/Home/View/Draw/roomlist.html',
      1 => 1532860296,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '12115815395b5d47ff155972-68152944',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.6',
  'unifunc' => 'content_5b5d47ff1eff9',
  'variables' => 
  array (
    'rooms' => 0,
    'v' => 0,
    'vv' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5b5d47ff1eff9')) {function content_5b5d47ff1eff9($_smarty_tpl) {?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>房间列表</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="<?php echo @PUBLIC_PATH;?>
css/amazeui.min.css">
    <script type="text/javascript" src="<?php echo @PUBLIC_PATH;?>
js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="<?php echo @PUBLIC_PATH;?>
js/amazeui.min.js"></script>
    <style>
        .am-badge{
            float: right;
            line-height:normal;
        }
        .am-img-thumbnail{
            width:40px;
        }
    </style>
</head>
<body>
    <ul class="am-list am-list-border">
        <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['rooms']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
$_smarty_tpl->tpl_vars['v']->_loop = true;
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
        <li data-uid="<?php echo $_smarty_tpl->tpl_vars['v']->value['uid'];?>
" data-href="<?php echo @__CONTROLLER__;?>
/inroom/uid/<?php echo $_smarty_tpl->tpl_vars['v']->value['uid'];?>
"><a><i class="am-icon-home am-icon-fw"></i>
            <?php echo $_smarty_tpl->tpl_vars['v']->value['uid'];?>

            <?php  $_smarty_tpl->tpl_vars['vv'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['vv']->_loop = false;
 $_smarty_tpl->tpl_vars['kk'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['v']->value['users']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['vv']->key => $_smarty_tpl->tpl_vars['vv']->value){
$_smarty_tpl->tpl_vars['vv']->_loop = true;
 $_smarty_tpl->tpl_vars['kk']->value = $_smarty_tpl->tpl_vars['vv']->key;
?>
                <img src="<?php echo $_smarty_tpl->tpl_vars['vv']->value['main_img'];?>
" alt="..." class="am-img-thumbnail am-radius">
            <?php } ?>
            <?php if ($_smarty_tpl->tpl_vars['v']->value['is_playing']){?>
                <span class="am-badge am-badge-danger">正在游戏</span>
            <?php }else{ ?>
                <span class="am-badge am-badge-success">等待中</span>
            <?php }?>
        </a></li>
        <?php } ?>
    </ul>
    <div style="text-align: center">
        <a class="am-btn am-btn-success" href="<?php echo @__CONTROLLER__;?>
/createroom" >创建房间</a>
    </div>
</body>
<script>
    $(".am-list li").click(function () {
        thisli=$(this);
        $.post("<?php echo @__MODULE__;?>
/Ajax/is_playing",{ uid:thisli.data("uid")},function (ret) {
            if(ret){
                alert("此房间已开始游戏！")
                window.location.reload()
            }else{
                // console.log(thisli.data("href"))
                window.location.href=thisli.data("href")
            }
            console.log(ret)
        })
    })
</script>
</html><?php }} ?>